/**
 * fileName:  ParamValueRelBean.java
 * author:  Lei
 * Company:  Cloudland Studio
 * Createdate:  2014-6-11 下午10:22:09
 *
 * All rights Reserved, Designed By cloudland Copyright(C) 2010-2011
 *   
 * Modification  History:
 *     Date           Author        Version        
 * -------------------------------------------
 * 2014-6-11          Lei            1.0        
 *
 * Why & What is modified:
 * 1.0: 文件创建
 */
package org.cloudland.commercial.masterdata.handler.support;

import org.cloudland.commercial.masterdata.bean.ChooseType;
import org.cloudland.commercial.masterdata.bean.ParamValueRelation;
import org.cloudland.commercial.masterdata.store.entity.ParamValueRelEntity;
import org.cloudland.commercial.masterdata.store.write.ParamValueRelWriter;

 /**
 * <pre> 
 * 
 * </pre>
 * @ClassName  ParamValueRelBean
 * @author  Lei
 * @version  %I%, %G%
 * @see  
 * @since   JDK1.6
 *
 */
public class ParamValueRelBean implements ParamValueRelation {
	
	/**
	 * paramValueRelEntity 参数与值关系
	 */
	private ParamValueRelEntity paramValueRelEntity;
	
	/**
	 * paramValueRelWriter 写数据库操作
	 */
	private ParamValueRelWriter paramValueRelWriter;
	
	/**
	 * extend 是否扩展信息
	 */
	private Boolean extend = false;
	
	/**
	 * <pre>
	 * TODO 请充分描述该构造函数的作用，及其参数的作用。
	 * </pre>
	 *   
	 */
	public ParamValueRelBean(ParamValueRelEntity paramValueRelEntity, ParamValueRelWriter paramValueRelWriter) {
		this.paramValueRelEntity = paramValueRelEntity;
		this.paramValueRelWriter = paramValueRelWriter;
	}
	
	/**
	 * <pre>
	 * TODO 请充分描述该构造函数的作用，及其参数的作用。
	 * </pre>
	 *   
	 */
	public ParamValueRelBean(String categoryId, ParamValueRelWriter paramValueRelWriter) {
		this(new ParamValueRelEntity(), paramValueRelWriter);
		this.paramValueRelEntity.setCategoryId(categoryId);
	}
	
	/**
	 * <pre>
	 * 获取主键编号
	 * </pre>
	 *
	 * @return   
	 */
	public String getId() {
		return paramValueRelEntity.getId();
	}

	/**
	 * @param argumentInfo
	 */
	public void setParamId(String argumentId) {
		this.paramValueRelEntity.setArgumentId(argumentId);
	}
	
	/**
	 * @return
	 */
	public String getParamId() {
		return paramValueRelEntity.getArgumentId();
	}

	/**
	 * @param costInfo
	 */
	public void setValueId(String costId) {
		this.paramValueRelEntity.setCostId(costId);
	}
	
	/**
	 * @return
	 */
	public String getValueId() {
		return paramValueRelEntity.getCostId();
	}

	/**
	 * @param sort
	 */
	public void setSort(Integer sort) {
		paramValueRelEntity.setSort(sort);
	}
	
	/**
	 * @return
	 */
	public Integer getSort() {
		return paramValueRelEntity.getSort();
	}

	/**
	 * @param choose
	 */
	public void setChooseType(ChooseType choose) {
		this.paramValueRelEntity.setChooseType(choose);
	}
	
	/**
	 * @return
	 */
	public ChooseType getChooseType() {
		return this.paramValueRelEntity.getChooseType();
	}
	
	/**
	 * @return
	 */
	public Boolean isExtend() {
		return this.extend;
	}
	
	/**
	 * set extend
	 * @param extend the value of extend
	 */
	public void setExtend(Boolean extend) {
		this.extend = extend;
	}

	public void submit() {
		
		if (null != paramValueRelEntity.getId() && paramValueRelEntity.getId().length() > 0) {
			paramValueRelWriter.update(paramValueRelEntity);
		} else {
			paramValueRelWriter.save(paramValueRelEntity);
		}
		
		
	}
}
